import { IPSModelObject } from '../../../ipsmodel-object';

/**
 * 模型填充辅助类
 *
 * @author chitanda
 * @date 2021-04-01 14:04:37
 * @export
 * @class ModelObjectFillHelp
 */
export class ModelObjectFillHelp {
  /**
   * 填充主要子数据
   *
   * @author chitanda
   * @date 2021-04-01 14:04:50
   * @static
   * @param {IPSModelObject} modelObj
   * @return {*}  {Promise<void>}
   */
  static async fillMainChild(modelObj: IPSModelObject): Promise<void> {
    await this.fillGetPSAppDataEntity(modelObj);
  }

  /**
   * 填充应用实体
   *
   * @author chitanda
   * @date 2021-04-01 14:04:15
   * @static
   * @param {IPSModelObject} modelObj
   * @return {*}  {Promise<void>}
   */
  static async fillGetPSAppDataEntity(modelObj: IPSModelObject): Promise<void> {
    if (modelObj['getPSAppDataEntity']) {
      const entity: IPSModelObject = modelObj['getPSAppDataEntity']();
      if (entity) {
        await entity.fill();
      }
    }
  }
}
